kernel.o: kernel.c
	i386-elf-gcc -ffreestanding -c $< -o $@

kernel_entry.o: kernel_entry.asm
	nasm -felf $< -o $@

kernel.bin: kernel_entry.o kernel.o
	i386-elf-ld -o $@ -Ttext 0x1000  $^ --oformat binary

bootsect.bin: bootsect.asm
	nasm -fbin $< -o $@

os-image.bin: bootsect.bin kernel.bin
	cat $^ > $@

all: os-image.bin

clean:
	rm -f *.o *.bin